package ar.edu.unq.leezsi.model;

import java.util.ArrayList;
import java.util.List;

public class ListModel<T> extends Model<T> {

	public ListModel(List<T> target) {
		super(target);
	}

	@Override
	@SuppressWarnings("unchecked")
	public List<?> get(String property) {
		List<T> tar = (List<T>) (this.getTarget());
		List<Object> ret = new ArrayList<Object>();
		for (T t : tar) {
			ret.add(new Model<T>(t).get(property));
		}
		return ret;
	}

	@Override
	public void set(String property, Object value) {
		@SuppressWarnings("unchecked")
		List<T> tar = (List<T>) (this.getTarget());
		for (T t : tar) {
			new Model<T>(t).set(property, value);
		}
	};
}
